unit Td_vendor_Edit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, Td_Trader_Edit, cxGraphics, cxControls, cxLookAndFeels,
  cxLookAndFeelPainters, cxContainer, cxEdit, dxSkinsCore,
  dxSkinsDefaultPainters, dxSkinscxPCPainter, cxStyles,
  cxDataStorage, DB, cxDBData,
  cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
  cxGridCustomView, cxGrid, cxDropDownEdit, StdCtrls, cxRadioGroup,
  cxDBEdit, cxMaskEdit,
  cxDBLookupComboBox, cxCheckBox, cxPC, cxTextEdit, cxLabel,
  Buttons, ExtCtrls, Menus, MisString,
  cxCurrencyEdit, cxImage, cxMemo, ExtDlgs, cxSpinEdit,
  ComCtrls, dxSkinsForm,
  dxBarBuiltInMenu, cxNavigator, cxCustomData, cxFilter, cxData, MemDS,
  DBAccess, Uni, cxListView, cxButtons, cxGridLevel, EidtShare, cxGroupBox,
  cxLookupEdit, cxDBLookupEdit, System.Actions, Vcl.ActnList;

type
  TFrmtd_Vendor_Edit = class(TFrmtd_Trader_Edit)
    MainDataSetcloudacc: TWideStringField;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }

  protected
    procedure OnNewRecord(DataSet: TDataSet); override;
    function  GetNewCode: string; override;
  public
    { Public declarations }
  end;

var
  Frmtd_Vendor_Edit: TFrmtd_Vendor_Edit;

implementation



{$R *.dfm}

procedure TFrmtd_Vendor_Edit.OnNewRecord(DataSet: TDataSet);
begin
  inherited;
  DataSet.FieldByName('Client').AsBoolean := False;
  DataSet.FieldByName('Provider').AsBoolean := True;
end;

function TFrmtd_Vendor_Edit.GetNewCode: string;
begin
  Result := GetNewCodeValue(FTableName, FCodeField, FKeyField, ' And Provider = 1 ');
  if Result = '001' then
    Result := 'P001'  
end;

procedure TFrmtd_Vendor_Edit.FormCreate(Sender: TObject);
begin
  LookupID := 'td_traderprovider';
  inherited;
end;

end.

